#include <iostream>
#include "ThreadPool.h"
#include <chrono>



int main(int argc, char* argv[])
{
    ThreadPool pool;
    //创建线程向任务队列添加任务

    std::thread thd1([&pool](){
        for (size_t i = 0; i < 10; i++)
        {
            auto thid = std::this_thread::get_id();
            pool.AddTask([thid, i](){
                std::cout << "ThreadID:"<< thid << "Task" << i << "Done!" << std::endl;
                std::this_thread::sleep_for(std::chrono::milliseconds(500));
            });
        }
        
    });
    thd1.join();
    pool.Stop();
    return 0;
}